import EventMgr from "../../../../Core/Event/EventMgr";
import UICore from "../../../../Core/Res/UICore";
import SdkTool from "../../../../Core/Sdk/SdkTool";
import { ViewManager } from "../../base/ViewManager";
import { GameModels } from "../../socket/GameModels";
import AbstractUIWindow from "../../window/AbstractUIWindow";
import * as fgui from "fairygui-cc";

export class TeacherRewardWindow extends AbstractUIWindow {
    private get: fgui.GButton;
    private gettwo: fgui.GButton;
    protected getResList(): Array<string> {
        return ["Plane"];
    }
    protected onInit(): void {
        this._view = UICore.createObject("Plane", "TeacherRewardWindow").asCom;
    }
    protected onShow(): void {
        EventMgr.on(`event_RespFinishGuide`, this.event_RespFinishGuide, this);
        this.get.onClick(this.clickget, this);
        this.gettwo.onClick(this.clickgettwo, this);
    }
    private event_RespFinishGuide(): void {
        this.close();
    }
    private clickget(): void {
        GameModels.support.send_ReqFinishGuide();
    }

    private clickgettwo(): void {
        SdkTool.ins.sdk.playRewardAd((play) => {
            if (play) {
                GameModels.support.send_ReqFinishGuide(1);
            }
        }, this);
    }
}